package com.pipi.mq.rocketmq.base.consumer.config;

import com.pipi.mq.rocketmq.base.config.PropertiesConfig;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;

/**
 * @Package com.pipi.mq.rocketmq.base
 * @author: 皮皮（pipi@maihaoche.com）
 * @date: 2020/4/18 2:44 PM
 */
@Configuration
@ComponentScan(value = {"com.pipi.mq.rocketmq.base.consumer"})
@PropertySource("classpath:application.properties")
public class ConsumerConfig {

    @Bean
    @Scope("prototype")
    public DefaultMQPushConsumer getDefaultMQPushConsumer() {
        DefaultMQPushConsumer consumer = new DefaultMQPushConsumer();
        consumer.setNamesrvAddr(PropertiesConfig.nameServerAddress);
        return consumer;
    }
}
